#include<iostream>
using namespace std;
const int N = 1e5 + 10;
int n = 0;
int a[N];
int sum,ret;
int main()
{
	cin >> n;
	for (int i = 1;i <= n;i++)
	{
		cin >> a[i];
		sum += a[i];
	}
	sum /= n;
	for (int i = 1;i <= n;i++)
	{
		int x =sum-a[i];
		a[i + 1] -= x;
		if (x != 0) ret++;
	}
	cout << ret << endl;
	return 0;
}